﻿using System;
using Avalonia.Media;
using AvaloniaEdit.CodeCompletion;
using AvaloniaEdit.Document;
using AvaloniaEdit.Editing;
using MarkdownRow.Assets;
using MarkdownRow.Edit.CompletionView;

namespace MarkdownRow.Edit.CompletionData;

public abstract class CompletionData : ICompletionData
{
    public abstract void Complete(TextArea textArea, ISegment completionSegment, EventArgs insertionRequestEventArgs);

    public IImage? Image { get; protected init;}
    public string Text { get; }
    public object Content { get; }
    public object Description { get; }
    public double Priority => 0;

    protected CompletionData(DocItem item)
    {
        Text = item.Text;
        Description = new DescriptionView(item.Description,item.Text);
        Content = item.Name;
        Image = null;
    }
}